<template>
  <view></view>
</template>

<script>
import { aLiPay, paidMember } from '@/api/index'

export default {
  data() {
    return {
      userInfo: {},
    };
  },
  async onLoad(options) {
    if(options.out_trade_no) {
      paidMember({
        orderNo: options.out_trade_no,
        orderAmount: options.total_amount * 1,
      }).then(() => {
        uni.showToast({
          icon: 'none',
          title: `支付成功,请返回公众号`
        })
      })
    } else if(options.deptId) {
      const parameter = {
        totalAmount: options.totalAmount,
        payType: options.payType,
        outTradeNo: options.orderCode,
        subject: options.subject,
        deptId: options.deptId,
        userId: options.userId,
        userName: options.userName,
        phonenumber: options.phonenumber,
      }
      aLiPay(parameter).then(res => {
        document.write(res.msg)
      })
    }
  },
  methods: {
  },
};
</script>
